#ifndef _STDCPP_USART_
#define _STDCPP_USART_
/*******************************************************************************
 ** Name: usart                                                               **
 ** Description:                              **
 **                                                                           **
 ** Open Source Initiative (OSI) Approved License: CDDL                       **
 **                                                                           **
 ** The contents of this file are subject to the terms of the                 **
 ** Common Development and Distribution License, Version 1.0 only             **
 ** (the "License").  You may not use this file except in compliance          **
 ** with the License.                                                         **
 **                                                                           **
 ** You can find a copy of the license in the license.txt within              **
 ** this distribution or at http://opensource.org/licenses/CDDL-1.0.          **
 ** Software distributed under the License is distributed on an "AS IS"       **
 ** basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.           **
 ** See the License for the specific language governing permissions           **
 ** and limitations under the License.                                        **
 **                                                                           **
 ** When distributing Covered Code, include this CDDL header in each          **
 ** file and include the License file at license.{pdf|rtf|otf}.               **
 ** If applicable, add the following below this header, with the indicated    **
 ** fields enclosed by brackets "[]" replaced with your own identifying       **
 ** information: Portions Copyright [yyyy] [name of copyright owner]          **
 **                                                                           **
 ** Copyright (c) 2009-2010  Barry Gian James <bjames@avr-firmware.net>       **
 ** All rights reserved.                                                      **
 **                                                                           **
 ** Ref: $HeadURL$
 ******************************************************************************/
// Portions (C) 2011-13 Open Design Strategies, LLC.
// All Rights Reserved

// $Id$
// Last Modified $Date$ by $Author$

#include "common.h"

BEGIN_NAMESPACE(avr)

/// Base class for all peripherals
class Peripheral
{
public:
	Peripheral() { _id = _incrID(); }
	virtual ~Peripheral() { }

	virtual uint8_t ID() { return _id; }

	virtual void	powerUp() = 0;
	virtual void	powerDown() = 0;
	virtual char *	type() = 0;	// return ie "usart"
	virtual bool	init() = 0;

protected:
	static uint8_t _incrID() { return ++_ids; }
	static uint8_t _ids;
	uint8_t _id;
};

uint8_t Peripheral::_ids = 0;

END_NAMESPACE()


#endif /* USART_ */
